package com.manage.utils;


import cn.hutool.core.date.DateUtil;

import java.util.Date;
import java.util.UUID;

public class FileTool {

    public static String createUniqueFileName(String oldFileName) {
        StringBuilder sb = new StringBuilder();
        sb.append(DateUtil.format(new Date(), "yyyyMMdd"));
        sb.append("/");
        String uuid = UUID.randomUUID().toString();
        String fileName = uuid.replaceAll("-", "");
        sb.append(fileName);
        sb.append(oldFileName.substring(oldFileName.indexOf(".")));
        return sb.toString();
    }


}
